package org.homework;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        SupermarketService supermarketService = new SupermarketService();
        supermarketService.purchase();
        while(true){
            supermarketService.view();
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入数字：");
            Integer number = scanner.nextInt();
            switch (number){
                case 1:
                    System.out.println("请输入商品名称：");
                    String name = scanner.next();
                    System.out.println("请输入商品数量：");
                    Integer price = scanner.nextInt();
                    String msg = supermarketService.purchaseProduct(name,price);
                    System.out.println(msg);
                    break;
                case 2:
                    supermarketService.displayInventory();
                    break;
                case 3:
                    System.out.println("退出系统");
                    System.exit(0);
                    break;
                default:
                    System.out.println("输入错误");
               }
        }
    }
}
